// 源码漏洞检测表格
import React from 'react';
import PropTypes from 'prop-types';
import { Table } from '@teamix/ui';
import IssuesTable from './issuesTable';
import './index.scss';
import intl from '../../locale';

export default class BuildIssuesList extends React.Component {
  static propTypes = {
    branchName: PropTypes.string,
    buildResult: PropTypes.object,
    filterParams: PropTypes.object,
    updateCommitId: PropTypes.func,
  };

  static defaultProps = {
    branchName: 'master',
    filterParams: {},
    updateCommitId: () => {},
  };

  render() {
    return (
      <div className="build-issue-list-container">
        <div className="build-issue-list-header">
          <Table
            className={'issue-table'}
            dataSource={[
              {
                id: 0,
                title: (
                  <>
                    <span style={{ marginLeft: '24px' }} />
                    {intl.get({
                      id: 'code-assets.components.pinpointBuildIssuesList.Problem',
                      defaultMessage: '问题',
                    })}
                  </>
                ),
                file_name: intl.get({
                  id: 'code-assets.components.pinpointBuildIssuesList.FileName',
                  defaultMessage: '文件名',
                }),
                level: intl.get({
                  id: 'code-assets.components.pinpointBuildIssuesList.ProblemLevel',
                  defaultMessage: '问题等级',
                }),
                status: intl.get({
                  id: 'code-assets.components.pinpointBuildIssuesList.State',
                  defaultMessage: '状态',
                }),
                owner: intl.get({
                  id: 'code-assets.components.pinpointBuildIssuesList.ProblemIngress',
                  defaultMessage: '问题引入人',
                }),
                intro_time: intl.get({
                  id: 'code-assets.components.pinpointBuildIssuesList.ImportTime',
                  defaultMessage: '引入时间',
                }),
              },
            ]}
            hasBorder={false}
            hasHeader={false}
          >
            <Table.Column
              title={intl.get({
                id: 'code-assets.components.pinpointBuildIssuesList.Problem',
                defaultMessage: '问题',
              })}
              dataIndex="title"
              className="pinpoint-issue-title-col"
            />
            <Table.Column
              title={intl.get({
                id: 'code-assets.components.pinpointBuildIssuesList.FileName',
                defaultMessage: '文件名',
              })}
              dataIndex="file_name"
              className="pinpoint-issue-file-col"
            />
            <Table.Column
              title={intl.get({
                id: 'code-assets.components.pinpointBuildIssuesList.ProblemLevel',
                defaultMessage: '问题等级',
              })}
              dataIndex="level"
              className="pinpoint-issue-level-col"
            />
            <Table.Column
              title={intl.get({
                id: 'code-assets.components.pinpointBuildIssuesList.State',
                defaultMessage: '状态',
              })}
              dataIndex="status"
              className="pinpoint-issue-level-col"
            />
            <Table.Column
              title={intl.get({
                id: 'code-assets.components.pinpointBuildIssuesList.ProblemIngress',
                defaultMessage: '问题引入人',
              })}
              dataIndex="owner"
              className="pinpoint-issue-owner-col"
            />
            <Table.Column
              title={intl.get({
                id: 'code-assets.components.pinpointBuildIssuesList.ImportTime',
                defaultMessage: '引入时间',
              })}
              dataIndex="intro_time"
              className="pinpoint-issue-time-col"
            />
          </Table>
        </div>
        <div className="build-issue-list-waiting">
          <IssuesTable
            headerTitle={intl.get({
              id: 'code-assets.components.pinpointBuildIssuesList.UnresolvedIssues',
              defaultMessage: '未解决问题',
            })}
            issue_status="unresolved"
            {...this.props}
          />
        </div>
        <div className="build-issue-list-fixed">
          <IssuesTable
            headerTitle={intl.get({
              id: 'code-assets.components.pinpointBuildIssuesList.ResolvedIssue',
              defaultMessage: '已解决问题',
            })}
            issue_status="resolved"
            {...this.props}
          />
        </div>
      </div>
    );
  }
}
